home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / subdFindProxyModePolygon.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  2.0 KB  |  64 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //    Alias|Wavefront Script File
  19. //
  20. //    Creation Date:    Nov 4, 1999
  21. //
  22. //    Procedure:
  23. //        subdFindPolyForHierMode
  24. //
  25. //    Description:
  26. //        Given a subdivision surface (with construction history),
  27. //      return the name of the upstream polygon used when in
  28. //      "polygon proxy" mode.
  29. //
  30. global proc string subdFindProxyModePolygon( string $subd ) 
  31. {
  32.     string $result = "";
  33.  
  34.     // Ordinarilly, this would be called with a subdivision surface as
  35.     // $subd.  However, dagMenuProc.mel may call it with a transform
  36.     // above it instead, so we do a filterExpand, just in case.
  37.     //
  38.     global int $gSelectSubdivSurface;
  39.     string $list[]=`filterExpand -ex 1 -fp 1 -sm $gSelectSubdivSurface $subd`;
  40.     int $len = size($list);
  41.     if( $len > 0 ) {
  42.         $subd = $list[0];
  43.     }
  44.  
  45.     // If we're not in polygon mode, no point in looking
  46.     // for the polygon proxy.
  47.     //
  48.     int $whichMode = `subdiv -q -proxyMode $subd`;
  49.     if( 1 != $whichMode ) {
  50.         error( $subd + ": subdivision surface is not in polygon mode." );
  51.         return $result;
  52.     }
  53.  
  54.     string $hist[] = `listHistory $subd`;
  55.     for( $histNode in $hist ) {
  56.         if( "mesh" == `nodeType $histNode` ) {
  57.             $result = $histNode;
  58.             break;
  59.         }
  60.     }
  61.  
  62.     return $result;
  63. }
  64.